#!/bin/bash
# 以下命令在Python3环境下执行

module load tabix/0.2.6-foss-2016b BCFtools/1.10.2 Python/3.11.4 R/4.0.0

python3 filter_locus.py ../genotype/SNP.imputed.vcf F_code M_code filter 0.01
bgzip ../genotype/SNP.imputed.vcf
bcftools index -t ../genotype/SNP.imputed.vcf.gz
bcftools view -R filter_locus.bed ../genotype/SNP.imputed.vcf.gz -o filter.vcf

python compare.py ./filter.vcf F_code ./

module unload Python/3.11.4
module load Python/2.7.15

for i in {1..10}
do
    python ~/software/snpbinner crosspoints --input ./crosspoints_${i}.tsv --output ./crosspoints_out_${i}.tsv -r 0.001
    python ~/software/snpbinner bins --input ./crosspoints_out_${i}.tsv --output ./bin_out_${i}.tsv --min-bin-size 500
done

module unload Python/2.7.15
module load Python/3.11.4

python get_bins.py ./
python bin2listeria.py ./

Rscript plot.R ./bin_data.csv ./

